#define _CRT_SECURE_NO_WARNINGS 1

int main()
{
    int len = strlen(S);
    char* str = (char*)calloc(len * 3, 1);
    char* p = S;
    int pos = 0;
    whlie((*p) != '\0')
    {
        char* c = p + 1;
        while ((*c) == (*p) && (*c) != '\0')
        {
            c++;
        }
        int l = c - p;
        str[pos++] = *p;
        pos += sprintf(str + pos, "%d", l);
        p = c;
    }
	return 0;
}